<%@ page isELIgnored="false" language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<c:set var="_path" value="${pageContext.request.contextPath}"></c:set>
<script type="text/javascript">
	jQuery(function($){
		//下拉表格初始化
		$('#addDeptId').combobox({
			valueField:'id', //值字段
		    textField:'name', //显示的字段
		    url:'dept/allList',
		    panelHeight:'auto',
		    required:true,
			editable:false//不可编辑，只能选择
		});
	});
	
	function addOrUpdateUser(){
		var r = $('#aacForm').form('validate');
		if(!r) {
			return false;
		}
	    if($('#id').val()!='')
	    {

			$.post("aac/aacUpdate",$("#aacForm").serializeArray(),function(data){
				$('#MyPopWindow').window('close');
				$('#aacTable').datagrid('reload');  
				$.messager.alert('提示',data.mes,'info');
			});
	    }else
	    {
			$.post("aac/aacAdd",$("#aacForm").serializeArray(),function(data){
				$('#MyPopWindow').window('close');
				$('#aacTable').datagrid('reload');  
				$.messager.alert('提示',data.mes,'info');
			});
	    }
	    
	}
	function selectAab(){
		var div = $('<div id="_aabSelect"></div>').appendTo($('body'));
		$(div).window({
			title: '选择商户',
			width: 700,
			height:390,
			href:'${_path}/aac/aacAddList',
			collapsible : false,
			resizable : false,
			minimizable : false,
			maximizable : false,
			onClose : function(){
				$(this).window('destroy');
			}
		});
	}
</script>
<!-- 验证还是jquery-validation好用，这里省事没用 -->
<form id="aacForm" method="post" style="margin: 10;text-align: center;">
	<input type="hidden" name="version" value="${aac.version }">
	<input type="hidden" name="delflg" value="${aac.delflg }">
	<input type="hidden" name="creatuserid" value="${aac.creatuserid }">
	<table>
		<tr>
			<td>登记日期：</td>
			<td><input name="creatdate" value='<fmt:formatDate value="${aac.creatdate }" pattern="yyyy-MM-dd"/>' style="width: 200"
				 class="easyui-datebox" required="true" readonly="readonly" >
			</td>
		</tr>
		<tr>
			<td>POS机识别码：</td>
			<td><input name="cardkey" value="${aac.cardkey }" style="width: 200"
				class="easyui-validatebox" validType="length[3,40]" required="true"></td>
		</tr>
		<tr>
			<td>POS机登录密码：</td>
			<td><input name="pospassword" type="passowrd" value="${aac.pospassword }" style="width: 200"
				class="easyui-validatebox" required="true"></td>
		</tr>
		<tr>
			<td>使用商户：</td>
			<td>
				<input type="hidden" id="shopid" name="shopid" value="${aac.shop.id }"/>
				<input name="shop.nameall" id="shop_nameall" onClick="selectAab()" value="${aac.shop.nameall }" style="width: 200"
					  class="easyui-validatebox" required="true">
			</td>
		</tr>
		<tr>
			<td>IP地址：</td>
			<td>
				<input name="ipaddress" required="true" class="easyui-validatebox"  value="${aac.ipaddress }" >
			</td>
		</tr>
		<tr>
			<td>使用商户名称(简)：</td>
			<td>
				<span id="shop_namesimp">${aac.shop.namesimp }</span>
			</td>
		</tr>
		<tr>
			<td>负责人移动电话：</td>
			<td>
				<span id="shop_telephone">${aac.shop.telephone }</span>
			</td>
		</tr>
		<tr>
			<td>商户地址：</td>
			<td>
				<span id="shop_address">${aac.shop.address }</span>
			</td>
		</tr>
	</table>
	<a href="#" id="btn-back" onclick="closeWindow();" class="easyui-linkbutton" iconCls="icon-back">返回</a>
	<a href="#" id="btn-add" onclick="addOrUpdateUser();" class="easyui-linkbutton" iconCls="icon-save">保存</a>
</form>